/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package collections;
import java.util.*;
/**
 *
 * @author anonymous
 */
public class Robot {
    private String name = "";
    private Vector<String> weapons  = new Vector<>();
    private int bullets = 0;

    public Robot( Robot robot ) {
        //cloning weapons
        for( String weapon : robot.getWeapons() ) {
            this.addWeapon( weapon );
        }
        //cloning bullets
        this.addBullets(robot.getBullets());
        //cloning name
        this.name = robot.getName();
    }
    public Robot() {
        
    }
    
    public Vector<String> getWeapons() {
        return weapons;
    }

    public String getName() {
        return name;
    }

    public int getBullets() {
        return bullets;
    }
    
    public boolean addWeapon( String weapon) {
        return weapons.add(weapon);
    }
    
    public void addBullets( int bullets) {
        this.bullets += bullets;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    @Override
    public Robot clone(){
        return new Robot(this);
    }
    
    public boolean equals(Robot robot) {
        if( !robot.getWeapons().equals(this.getWeapons()) ) {
            return false;
        }
        if( !robot.getName().equals(this.getName())) {
            return false;
        }
        
        if( robot.getBullets() != this.getBullets() ) {
            return false;
        }
        return true;
    }
    
}
